<template>
  <!-- 入库管理列表 -->
	<div style="padding:20px 20px;" >
		<el-card class="xiu_box">
			<el-table v-loading="loading" :data="tableData"　 stripe style="width:100%; margin-top:20px;">
				<el-table-column header-align='center' align='center' label="类型" >
					<template slot-scope="scope">{{id_name(scope.row.typeId,$store.state.user.leidata)}}</template>
				</el-table-column>
				<el-table-column header-align='center' align='center' prop="sku"  label="物料编码" ></el-table-column>
				<el-table-column header-align='center' align='center' prop="name"  label="物品名称" ></el-table-column>
				<el-table-column header-align='center' align='center' label="状态" >
					<template slot-scope="scope">
							{{scope.row.isDone == 3?'待入库':''}}
					</template>
				</el-table-column>
				<el-table-column header-align='center' align='center' prop="createdTime"  label="创建时间" ></el-table-column>
				<el-table-column header-align='center' align='center' prop="amount" label="申请数量" ></el-table-column>
				<el-table-column header-align='center' align='center' prop="price" label="单价" >
					<template slot-scope="scope">{{scope.row.price}} ￥</template>
				</el-table-column>
				<el-table-column header-align='center' align='center' prop="remarks" label="备注" show-overflow-tooltip></el-table-column>
				<el-table-column header-align='center' align='center' prop="purpose" label="申请原因" show-overflow-tooltip></el-table-column>
				<el-table-column header-align='center' align='center' prop="username" label="申请人" ></el-table-column>
				<el-table-column header-align='center' align='center' width="170" label="操作">
					<template slot-scope="scope">
							<el-button class='btn' @click="xamine(scope.row)" type="warning">审核</el-button>
					</template>
				</el-table-column>
			</el-table>
			<!-- 分页 -->
			<el-pagination  v-show="totals>sizec" style=' margin-top:35px;width:100%;text-align: center;' :page-size="sizec" :total="totals" :page-sizes="ye_s"
			   background @size-change="handleSizeChange" @current-change="handleCurrentChange"layout="total, sizes, prev, pager, next, jumper">
			</el-pagination>
		</el-card>
	  <stockru ref="ss" :active="isActive" :datas="ware_data"></stockru>
	</div>
</template>

<script>
  import {examine,delStock} from '@/api_bast/stock.js'
  import stockru from '@/components/MES/stock/stockru.vue'
	export default {
		name: '',
		data(){
			return{
        ware_data:{
          sku:'', //物料编码
          isDone: '', //状态
          price: '', //单价
		  remarks: '', //备注
		  purpose: '', //申请原因
          username: '' ,//申请人
          name: '',//物品名称
          model: '',//物品型号
          size: '',//尺寸
          typeId: '',//类型
          provider: '',//供应商
          id: ''
        },
        isActive: false,
        page: 1,
        sizec: 15,
        ye_s: [15,20],
        // names: '',//查询条件
        loading:false,
        totals: 0, //总条数
        tableData: [] //返回数据
			}
		},
		components:{
      stockru
		},
    methods:{
      hidn(){//关闭审核
        this.$refs.ss.active = false
      },
      get_data(){//获取数据
        let dat = {
          // name:this.names,
          pageNo:this.page,
          pageSize:this.sizec
        }
        this.loading=true;
        examine(dat).then(res => {
          this.loading = false
          this.totals = res.resData.purchaseTsk.total;
          this.tableData = res.resData.purchaseTsk.list;
        })
        },
      handleSizeChange(val){//每页条数改变时触发
        this.sizec = val
        this.get_data()
      },
      handleCurrentChange(val){//当前页改变时触发
        this.page = val
        this.get_data()
      },
        xamine(i){//审核
            this.$refs.ss.qf()
            this.ware_data = i
        },

    },
    mounted() {
      this.get_data()
    }
	}
</script>

<style scoped="scoped">

</style>
